var t,
  a = require("../../@babel/runtime/helpers/defineProperty"),
  i = require("../../res/www.a9a.cn.js"),
  e = getApp(),
  s = 2,
  o = !0;
Page({
  data: {
    mask_class: "alpha0_100",
    izt_nodata: !1,
    showtype: 2,
    loading_flag: !1,
    loading_ico_flag: !1,
    loading_str: "玩命加载中",
    backtop_flag_index: !1,
  },
  onLoad: function (t) {
    var a = this,
      s = 0,
      o = 2;
    i.ifint(t.id) && (s = t.id),
      i.ifint(t.showtype) && (o = t.showtype),
      (i.ifint(s) || i.ifint(o)) && a.setData({ id: s, showtype: o }),
      e.get_config("_ZEAI").then(function (t) {
        a.setData({ color: e._ZEAI.color, rgbcolor: i.c16_rgb(e._ZEAI.color) });
      }),
      e.get_navigationBarTopHeight(a),
      this.init();
  },
  init: function () {
    var i = this;
    wx.showLoading({ title: "玩命加载中...", mask: !0 }),
      (o = !1),
      (t = wx.getStorageSync("COOK_U")),
      e.ajax({
        url: "izt.php",
        data: {
          submitok: "izt",
          openid: t.openid,
          id: i.data.id,
          showtype: i.data.showtype,
        },
        success: function (t) {
          var e;
          1 == t.flag
            ? 0 == t.LIST.length
              ? i.setData({
                  LIST: [],
                  KIND: t.KIND,
                  izt_nodata: !0,
                  D: t.D,
                  showtype: t.D.showtype,
                  SHARE: t.SHARE,
                })
              : i.setData(
                  (a((e = {}), "LIST[0]", t.LIST),
                  a(e, "KIND", t.KIND),
                  a(e, "D", t.D),
                  a(e, "showtype", t.D.showtype),
                  a(e, "SHARE", t.SHARE),
                  e)
                )
            : wx.showToast({ title: t.msg, icon: "none", mask: !0 });
          (o = !0), wx.hideLoading();
        },
      });
  },
  showtypeFn: function () {
    this.setData({ showtype_box: !0, mask_class: "alpha0_100" });
  },
  showtype_setFn: function (t) {
    var a = t.currentTarget.dataset.value;
    this.setData({ showtype: a });
  },
  showtype_box_closeFn: function (t) {
    var i = this,
      e = t.currentTarget.dataset.maskid;
    this.setData({ mask_class: "alpha100_0" }),
      setTimeout(function () {
        i.setData(a({}, e, !1));
      }, 500);
  },
  iztFn: function (t) {
    for (
      var a = t.currentTarget.dataset.id,
        i = t.currentTarget.dataset.idx,
        e = this.data.KIND,
        s = e.length,
        o = [],
        n = 0;
      n < s;
      n++
    )
      (e[n].ed = ""), o.push(e[n]);
    (o[i].ed = "ed"), this.setData({ KIND: o, id: a }), this.init();
  },
  onPageScroll: function (t) {
    t.scrollTop > 100
      ? this.setData({ backtop_flag: !0 })
      : this.setData({ backtop_flag: !1 });
  },
  setloading: function (t, a) {
    "start" == t
      ? this.setData({ loading_flag: !0, loading_ico_flag: !0, loading_str: a })
      : this.setData({
          loading_flag: !1,
          loading_ico_flag: !1,
          loading_str: a,
        });
  },
  onReachBottom: function () {
    var i = this.data.LIST,
      n = this;
    o &&
      ((o = !1),
      n.setloading("start", "拼命加载中"),
      e.ajax({
        url: "izt.php",
        data: {
          submitok: "izt",
          p: s,
          openid: t.openid,
          id: n.data.id,
          showtype: n.data.showtype,
        },
        success: function (t) {
          if (1 == t.flag) {
            var e = i.length;
            if (t.LIST.length < 1)
              return n.setloading("end", "已全部加载完毕"), void (o = !1);
            n.setData(a({}, "LIST[" + e + "]", t.LIST)), (s += 1), (o = !0);
          } else wx.showToast({ title: t.msg, icon: "none", mask: !0 });
          n.setloading("end", "上拉加载更多");
        },
      }));
  },
  backtopFn: function (t) {
    wx.pageScrollTo({ scrollTop: 0, duration: 300 });
  },
  onShareAppMessage: function (t) {
    return {
      imageUrl: this.data.SHARE.imgurl,
      title: this.data.SHARE.title,
      path: "/pages/izt/izt",
    };
  },
  onShareTimeline: function () {
    return {
      imageUrl: this.data.SHARE.imgurl,
      title: this.data.SHARE.title,
      query: "id=" + this.data.id,
      path: "/pages/izt/izt",
    };
  },
});
